import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 手环信息 */
export interface DeviceKidband {
          id: number; // 编号
          imei?: string; // 序列号
          nfcCode?: string; // NFC
          macCode?: string; // MAC地址
          schoolCode?: string; // 所属园区
          classId?: number; // 班级ID
          studentId?: number; // 学生ID
          studentName: string; // 学生姓名
          sort?: number; // 排序
          status?: number; // 状态
  }

// 手环 API
export const DeviceKidbandApi = {
  // 查询手环分页
  getDeviceKidbandPage: async (params: any) => {
    return await request.get({ url: `/school/device-kidband/page`, params })
  },

  // 查询手环详情
  getDeviceKidband: async (id: number) => {
    return await request.get({ url: `/school/device-kidband/get?id=` + id })
  },

  // 新增手环
  createDeviceKidband: async (data: DeviceKidband) => {
    return await request.post({ url: `/school/device-kidband/create`, data })
  },

  // 修改手环
  updateDeviceKidband: async (data: DeviceKidband) => {
    return await request.put({ url: `/school/device-kidband/update`, data })
  },

  // 删除手环
  deleteDeviceKidband: async (id: number) => {
    return await request.delete({ url: `/school/device-kidband/delete?id=` + id })
  },

  /** 批量删除手环 */
  deleteDeviceKidbandList: async (ids: number[]) => {
    return await request.delete({ url: `/school/device-kidband/delete-list?ids=${ids.join(',')}` })
  },

  // 导出手环 Excel
  exportDeviceKidband: async (params) => {
    return await request.download({ url: `/school/device-kidband/export-excel`, params })
  },
}